using UnityEngine;
using UnityEngine.UI;
using System;
using System.Collections.Generic;
using DTFight;

public class UIGameResult : MonoBehaviour
{
	public Text TxIndex;
	public Text TxWinGroup;
	public Image[] ImgCards = new Image[(int)CardData.CARD_TYPE.MAX];

	public GameData.ResultInfo InstData { get; set; }

	// Use this for initialization
	void Start ()
	{

	}

	// Update is called once per frame
	void Update ()
	{
		UpdateUI();
	}

	void UpdateUI()
	{
		if (InstData == null)
			return;

		if (TxWinGroup != null)	TxWinGroup.text = InstData.WinGroup.ToString();

		for (int i=0; i<ImgCards.Length; ++i)
		{
			if (ImgCards[i] == null)
				continue;

			string cardId = InstData.Cards[i].ToString();
			if (!ImgCards[i].sprite.name.Equals("b"+cardId))
				ImgCards [i].sprite = Resources.Load<Sprite> ("Cards_Nine/b"+cardId);
		}
	}
}

